﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="manage.aspx.cs" Inherits="AnyOffice.general.system.log.manage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>系统日志</title>
		<link rel="stylesheet" type="text/css" href="/module/date_selector/popcalendar.css">
		<script src="/module/date_selector/popcalendar.js"></script>
		<script src="/aspnet_client/core/function.js"></script>
		<script>
function CheckForm()
{
   if(document.Form1.txtBeginTime.value==""&&document.Form1.txtEndTime.value=="")
   {
		alert("起始时间和截止时间不能同时为空！");
		return (false);
   }
   
   if(!(checkIsDate(document.Form1.txtBeginTime.value) || checkIsDateTime(document.Form1.txtBeginTime.value)))
   {
	 alert("起始时间不正确！");
	 document.Form1.txtBeginTime.focus();
	 return (false);
   }
   
   if(!(checkIsDate(document.Form1.txtEndTime.value) || checkIsDateTime(document.Form1.txtEndTime.value)))
   {
	 alert("截止时间不正确！");
	 document.Form1.txtEndTime.focus();
	 return (false);
   }
   
   if(document.getElementById("rblAction_1") != null)
   {
	if(document.Form1.rblAction_1.checked)
	{
		if(!window.confirm("确定要删除吗，删除后将不可恢复！"))
			return (false);
	}
   }
   
   return true;
}
function delete_log(log_id)
{
 msg='确认要删除该系统日志么？';
 if(window.confirm(msg))
 {
  URL="delete.aspx?log_id=" + log_id;
  window.location=URL;
 }
}

function delete_all()
{
 msg='确认要清空全部系统日志么？';
 if(window.confirm(msg))
 {
  URL="delete_all.aspx";
  window.location=URL;
 }
}
		</script>
	</HEAD>
	<body class="bodycolor" style="padding-top:0;" topmargin="5">
    <div class="main_div">
		<form id="Form1" method="post" runat="server">
         
			<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
				<tr>
					<td class="tab_ti">
							<asp:Literal id="litNavTitle" runat="server" Text="系统日志查询 "></asp:Literal>
					</td>
				</tr>
			</table>
			<asp:Panel id="pnlMain" runat="server">
				<TABLE class="tab_pub" cellSpacing="0" cellPadding="0" width="500" align="center" border="0">
					<TR>
						<TD class="ta_bg" noWrap>日志类型：</TD>
						<TD class="ta_txt">
							<asp:DropDownList id="ddlLogType" runat="server" CssClass="BigSelect"></asp:DropDownList></TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>用户：</TD>
						<TD class="ta_txt"><INPUT id="ToId" type="hidden" name="ToId" runat="server"> <TEXTAREA class="BigStatic fl" id="ToName" name="ToName" rows="3" readOnly wrap="yes" cols="23"
								runat="server"></TEXTAREA>
								<INPUT class="bnt_Add fl" style="width:46px; display:inline-table;" title="添加用户" onClick="user_select('ToId','ToName','');" type="button"
								value="添加" name="button">
								<INPUT class="bnt_Del fl" style="width:46px; display:inline-table;" title="清空用户" onClick="clear_double('ToId','ToName');" type="button"
								value="清空" name="button">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>起始时间：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtBeginTime" type="text" maxLength="20" size="20" name="txtBeginTime"
								runat="server"><IMG style="CURSOR: hand" onClick="popUpCalendar(this,txtBeginTime,'yyyy-mm-dd','');"
								src="/module/date_selector/calendar.gif" align="absMiddle" border="0"> <IMG style="CURSOR: hand" onClick="popClock('txtBeginTime');" src="/images/menu/clock.gif"
								align="absMiddle" border="0">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>截止时间：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtEndTime" type="text" maxLength="20" size="20" value="2006-05-13 23:57:45"
								name="Time" runat="server"><IMG style="CURSOR: hand" onClick="popUpCalendar(this,txtEndTime,'yyyy-mm-dd','');" src="/module/date_selector/calendar.gif"
								align="absMiddle" border="0"> <IMG style="CURSOR: hand" onClick="popClock('txtEndTime');" src="/images/menu/clock.gif"
								align="absMiddle" border="0">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>IP地址：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtIp" type="text" maxLength="20" size="20" name="txtIp" runat="server"></TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>操作类型：</TD>
						<TD class="ta_txt">
							<asp:RadioButtonList id="rblAction" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
								<asp:ListItem Value="query" Selected="True">查询</asp:ListItem>
								<asp:ListItem Value="delete">删除</asp:ListItem>
							</asp:RadioButtonList></TD>
					</TR>
					<TR>
						<TD class="bnt_con" noWrap align="center" colSpan="2">
						<INPUT class="BigButton" title="" onClick="return CheckForm();" type="submit" value="确 定"
								name="button">
						</TD>
					</TR>
				</TABLE>
				<BR>
				<TABLE class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
					<TR>
						<TD class="tab_ti">
								清空系统日志
						</TD>
					</TR>
				</TABLE>
				<BR>
				<DIV align="center"><INPUT class="bnt_Del" onClick="javascript:delete_all();" type="button" value="清空系统日志">
				</DIV>
			</asp:Panel>
		</form>
		<asp:Panel id="pnlSearch" runat="server" Visible="False">
			<asp:Repeater id="rptLog" runat="server">
			<HeaderTemplate>			        
			<CENTER><INPUT class="BigButton" onClick="history.back();" type="button" value="返回"></CENTER>
			<BR>
					<table border="0" cellspacing="0" width="70%" align="center" class="tab_pub"
						cellpadding="0">
						<tr>
							<td class="TableHeader" nowrap align="center">用户姓名</td>
							<td class="TableHeader" nowrap align="center">时间</td>
							<td class="TableHeader" nowrap align="center">IP地址</td>							
							<td class="TableHeader" nowrap align="center">日志类型</td>
							<td class="TableHeader" nowrap align="center">备注</td>
							<td class="TableHeader" nowrap align="center">操作</td>
						</tr>
				</HeaderTemplate>
				<ItemTemplate>
					<tr class="TableLine1">
						<td nowrap align="center"><%#Eval("UserName") == DBNull.Value ? Eval("UserId") : Eval("UserName") %></td>
						<td nowrap align="center"><%#Eval("LogTime")%></td>
						<td nowrap align="center"><%#Eval("Ip")%></td>
						<td nowrap align="center"><%#Eval("CodeName")%></td>
						<td align="left"><%#Eval("Remark")%></td>
						<td nowrap align="center"><a href="javascript:delete_log(<%#Eval("LogId")%>);">删除</a></td>
					</tr>
				</ItemTemplate>
				<AlternatingItemTemplate>
					<tr class="TableLine2">
						<td nowrap align="center"><%#Eval("UserName") == DBNull.Value ? Eval("UserId") : Eval("UserName") %></td>
						<td nowrap align="center"><%#Eval("LogTime")%></td>
						<td nowrap align="center"><%#Eval("Ip")%></td>
						<td nowrap align="center"><%#Eval("CodeName")%></td>
						<td align="left"><%#Eval("Remark")%></td>
						<td nowrap align="center"><a href="javascript:delete_log(<%#Eval("LogId")%>);">删除</a></td>
					</tr>
				</AlternatingItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
				</asp:Repeater>
			<BR>
			<CENTER><INPUT class="BigButton" onClick="history.back();" type="button" value="返回"></CENTER>
		</asp:Panel>
		<asp:Literal id="litMessage" runat="server"></asp:Literal>
        </div>
	</body>
</HTML>
